package com.ruoyi.askcase.mapper;

import java.util.HashMap;
import java.util.List;
import com.ruoyi.askcase.domain.AskCase;
import org.apache.ibatis.annotations.Select;

/**
 * 病例管理Mapper接口
 * 
 * @author ruoyi
 * @date 2025-02-25
 */
public interface AskCaseMapper 
{
    /**
     * 查询病例管理
     * 
     * @param caseId 病例管理主键
     * @return 病例管理
     */
    public AskCase selectAskCaseByCaseId(Long caseId);

    /**
     * 查询病例管理列表
     * 
     * @param askCase 病例管理
     * @return 病例管理集合
     */
    public List<AskCase> selectAskCaseList(AskCase askCase);

    /**
     * 新增病例管理
     * 
     * @param askCase 病例管理
     * @return 结果
     */
    public int insertAskCase(AskCase askCase);

    /**
     * 修改病例管理
     * 
     * @param askCase 病例管理
     * @return 结果
     */
    public int updateAskCase(AskCase askCase);

    /**
     * 删除病例管理
     * 
     * @param caseId 病例管理主键
     * @return 结果
     */
    public int deleteAskCaseByCaseId(Long caseId);

    /**
     * 批量删除病例管理
     * 
     * @param caseIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAskCaseByCaseIds(Long[] caseIds);


    @Select("SELECT * from ask_case where case_remark = 1 order by case_id desc limit #{nums} ")
    List<HashMap<String,Object>> getHomecaseList(Integer nums);


    //0Select("SELEcT * from ask treat t LEFT jOIN ask case c ON ttreat caseid = c. case id where c case id = #fcaseId}
    @Select("SELECT * from ask_treat where treat_caseid = #{caseId} limit 2")
    List<HashMap<String, Object>> getTwoTreatsBycasId(Long caseId);

    @Select("SELECT * from ask_treat t left join ask_case c ON t.treat_caseid = c.case_id  where c.case_openid = #{openid} order by t.treat_id desc")
    List<HashMap<String, Object>> getMycaseListJoin(String openid);

    @Select("SELECT * from ask_case where case_openid = #{openid} order by case_id desc")
    List<HashMap<String, Object>> getMycaseList(String openid);
}
